bitkeeper revision 1.177 (3e9ddbaeZvT8WLJjkXqctK8YH2xb1A)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 16 Apr 2003 22:39:42 +0000 (22:39 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Wed, 16 Apr 2003 22:39:42 +0000 (22:39 +0000)
system.h, process.c:
  Fixed Xenolinux context switch code so that FS and GS are properly saved for the old process.

xenolinux-2.4.21-pre4-sparse/arch/xeno/kernel/process.c
xenolinux-2.4.21-pre4-sparse/include/asm-xeno/system.h

index 4dc1273c7bcc75834a9be3b612d5de71a5c20a42..d4db66747402aa93f37a90c298d3834848218e17 100644 (file)
@@ -369,13 +369,6 @@ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
     execute_multicall_list();
     __sti();
 
-    /*
-     * Save away %fs and %gs. No need to save %es and %ds, as
-     * those are always kernel segments while inside the kernel.
-     */
-    asm volatile("movl %%fs,%0":"=m" (*(int *)&prev->fs));
-    asm volatile("movl %%gs,%0":"=m" (*(int *)&prev->gs));
-
     /*
      * Restore %fs and %gs.
      */
index 387ac0fdadbc4cb4c9f42a675021501df5c16486..629c9d756bc9e2f8b18911cd1687ec3a059ceb6e 100644 (file)
 
 #ifdef __KERNEL__
 
-struct task_struct;    /* one of the stranger aspects of C forward declarations.. */
-extern void FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
-
-#define prepare_to_switch()    do { } while(0)
+struct task_struct;
+extern void FASTCALL(__switch_to(struct task_struct *prev, 
+                                 struct task_struct *next));
+
+#define prepare_to_switch()                                             \
+do {                                                                    \
+    struct thread_struct *__t = &current->thread;                       \
+    __asm__ __volatile__ ( "movl %%fs,%0" : "=m" (*(int *)&__t->fs) );  \
+    __asm__ __volatile__ ( "movl %%gs,%0" : "=m" (*(int *)&__t->gs) );  \
+} while (0)
 #define switch_to(prev,next,last) do {                                 \
        asm volatile("pushl %%esi\n\t"                                  \
                     "pushl %%edi\n\t"                                  \